import request from '@/utils/http'

const PATH = '/messages'

const baseURL = import.meta.env.VUE_APP_BASE_UPLOAD_API

export function upload(data: any) {
	return request({
		url: '/fileupload',
		method: 'post',
		headers: {
			'Content-Type': 'multipart/form-data'
		},
		data,
		baseURL
	})
}

export function getMessages(data: any) {
	return request({
		url: PATH + '/getmessages',
		method: 'get',
		params: data
	})
}

export function removeMessages(data: any) {
	return request({
		url: PATH + '/removemessages',
		method: 'delete',
		data
	})
}

export function removeAllMessages() {
	return request({
		url: PATH + '/removeallmessages',
		method: 'delete'
	})
}

export function readMessages(data: any) {
	return request({
		url: PATH + '/markasread',
		method: 'post',
		data
	})
}

export function readAllMessages() {
	return request({
		url: PATH + '/markasreadall',
		method: 'post'
	})
}

export function getNotifications(data: any) {
	return request({
		url: PATH + '/getnotifications',
		method: 'get',
		params: data
	})
}

export function removeNotifications(data: any) {
	return request({
		url: PATH + '/removenotifications',
		method: 'delete',
		data
	})
}

export function removeAllNotifications() {
	return request({
		url: PATH + '/removeallnotifications',
		method: 'delete'
	})
}

export function readNotifications(data: any) {
	return request({
		url: PATH + '/marknotificationasread',
		method: 'post',
		data
	})
}

export function readAllNotifications(data: any) {
	return request({
		url: PATH + '/markallnotificationsasread',
		method: 'post',
		data
	})
}

export function replyNotifications(data: any) {
	return request({
		url: PATH + '/replynotifications',
		method: 'post',
		data
	})
}

export function feedback(data: any) {
	return request({
		url: PATH + '/feedback',
		method: 'post',
		data
	})
}

export function getUnreadCount() {
	return request({
		url: PATH + '/getunreadcount',
		method: 'get'
	})
}
